package com.jfinal.server.undertow.util;

import org.wildfly.common.annotation.Nullable;

public abstract class Assert {

    /**
     * Assert that an object is not {@code null}.
     * <pre class="code">Assert.notNull(clazz, "The class must not be null");</pre>
     * @param object the object to check
     * @param message the exception message to use if the assertion fails
     * @throws IllegalArgumentException if the object is {@code null}
     */
    public static void notNull(@Nullable Object object, String message) {
        if (object == null) {
            throw new IllegalArgumentException(message);
        }
    }

    public static void notBlank(@Nullable String text, String message) {
        if (null == text || text.trim().isEmpty()) {
            throw new IllegalArgumentException(message);
        }
    }

}
